home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume2 / x11.3 / patch6 < prev    next >
Encoding:
Internet Message Format  |  1989-01-10  |  51.5 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v02i083:  X11 Release 3, Patch6
  5. Message-ID: <1979@wyse.wyse.com>
  6. Date: 11 Jan 89 00:01:38 GMT
  7. Organization: Wyse Technology, San Jose
  8. Lines: 1833
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: jim@expo.lcs.mit.edu (Jim Fulton)
  12. Posting-number: Volume 2, Issue 83
  13. Archive-name: x11.3/patch6
  14.  
  15.  
  16.  
  17.                Created on Monday, 9 January 1989
  18.  
  19.                   PART 2 of 3
  20.  
  21.  
  22. Fixes 5, 6, and 7 are part of a single update to the xman program.  Together
  23. they affect the following files:
  24.  
  25.     clients/xman/CHANGES
  26.     clients/xman/README
  27.     clients/xman/ScrollByL.c
  28.     clients/xman/TODO
  29.     clients/xman/buttons.c
  30.     clients/xman/defs.h
  31.     clients/xman/globals.c
  32.     clients/xman/globals.h
  33.     clients/xman/handler.c
  34.     clients/xman/help.c
  35.     clients/xman/main.c
  36.     clients/xman/man.c
  37.     clients/xman/man.h
  38.     clients/xman/menu.c
  39.     clients/xman/misc.c
  40.     clients/xman/pages.c
  41.     clients/xman/search.c
  42.     clients/xman/tkfuncs.c
  43.     clients/xman/version.h
  44.     clients/xman/xman.help
  45.     clients/xman/xman.man
  46.  
  47. To apply these fixes, concatenate all three files and pipe them to patch -p0
  48. from the top of your X sources:
  49.  
  50.     %  cat fix5 fix6 fix7 | patch -p0
  51.  
  52.  
  53. The following is fix6 (you will also need fix5 and fix7):
  54.  
  55.  
  56.  
  57. *** /tmp/,RCSt1a17133    Fri Jan  6 18:56:28 1989
  58. --- clients/xman/ScrollByL.c    Fri Jan  6 18:41:48 1989
  59. ***************
  60. *** 1,8 ****
  61.   /*
  62.    * xman - X window system manual page display program.
  63.    *
  64. !  * $XConsortium: ScrollByL.c,v 1.4 88/10/17 20:21:12 swick Exp $
  65. !  * $oHeader: ScrollByL.c,v 4.0 88/08/31 22:11:02 kit Exp $
  66.    *
  67.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  68.    *
  69. --- 1,8 ----
  70.   /*
  71.    * xman - X window system manual page display program.
  72.    *
  73. !  * $XConsortium: ScrollByL.c,v 1.5 89/01/06 18:41:40 kit Exp $
  74. !  * $Header: ScrollByL.c,v 1.5 89/01/06 18:41:40 kit Exp $
  75.    *
  76.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  77.    *
  78. ***************
  79. *** 21,27 ****
  80.    */
  81.   
  82.   #if ( !defined(lint) && !defined(SABER))
  83. !   static char rcs_version[] = "$Athena: ScrollByL.c,v 4.0 88/08/31 22:11:02 kit Exp $";
  84.   #endif
  85.   
  86.   /*
  87. --- 21,27 ----
  88.    */
  89.   
  90.   #if ( !defined(lint) && !defined(SABER))
  91. !   static char rcs_version[] = "$Athena: ScrollByL.c,v 4.5 88/12/19 13:46:04 kit Exp $";
  92.   #endif
  93.   
  94.   /*
  95. ***************
  96. *** 30,36 ****
  97.    * and do it much more like the Viewport widget in the Athena widget set.
  98.    * But this works and time is short, so here it is.
  99.    *
  100. !  *                                     Chris Peterson 1/30/88
  101.    */
  102.   
  103.   #include    <X11/IntrinsicP.h>
  104. --- 30,41 ----
  105.    * and do it much more like the Viewport widget in the Athena widget set.
  106.    * But this works and time is short, so here it is.
  107.    *
  108. !  *                                     Chris D. Peterson 1/30/88
  109. !  * 
  110. !  * I removed all the code for horizontal scrolling here, since is was a crock
  111. !  * anyway.
  112. !  * 
  113. !  *                                     Chris D. Peterson 11/13/88
  114.    */
  115.   
  116.   #include    <X11/IntrinsicP.h>
  117. ***************
  118. *** 59,65 ****
  119.   static XtResource resources[] = {
  120.       {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  121.        XtOffset(ScrollByLineWidget, scroll_by_line.foreground), 
  122. !          XtRString, "Black"},
  123.       {XtNinnerWidth, XtCWidth, XtRInt, sizeof(int),
  124.        XtOffset(ScrollByLineWidget, scroll_by_line.inner_width), 
  125.            XtRString, "100"},
  126. --- 64,70 ----
  127.   static XtResource resources[] = {
  128.       {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
  129.        XtOffset(ScrollByLineWidget, scroll_by_line.foreground), 
  130. !          XtRString, "XtDefaultForeground"},
  131.       {XtNinnerWidth, XtCWidth, XtRInt, sizeof(int),
  132.        XtOffset(ScrollByLineWidget, scroll_by_line.inner_width), 
  133.            XtRString, "100"},
  134. ***************
  135. *** 69,83 ****
  136.       {XtNforceBars, XtCBoolean, XtRBoolean, sizeof(Boolean),
  137.        XtOffset(ScrollByLineWidget, scroll_by_line.force_bars),
  138.            XtRString, "FALSE"},
  139. -     {XtNallowHoriz, XtCBoolean, XtRBoolean, sizeof(Boolean),
  140. -      XtOffset(ScrollByLineWidget, scroll_by_line.allow_horiz),
  141. -          XtRString, "FALSE"},
  142.       {XtNallowVert, XtCBoolean, XtRBoolean, sizeof(Boolean),
  143.        XtOffset(ScrollByLineWidget, scroll_by_line.allow_vert),
  144.            XtRString, "FALSE"},
  145. -     {XtNuseBottom, XtCBoolean, XtRBoolean, sizeof(Boolean),
  146. -      XtOffset(ScrollByLineWidget, scroll_by_line.use_bottom),
  147. -          XtRString, "FALSE"},
  148.       {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean),
  149.        XtOffset(ScrollByLineWidget, scroll_by_line.use_right),
  150.            XtRString, "FALSE"},
  151. --- 74,82 ----
  152. ***************
  153. *** 101,113 ****
  154.    *
  155.    ****************************************************************/
  156.   
  157. - static void HorizontalThumb();
  158.   static Boolean ScrollVerticalText();
  159.   static void VerticalThumb();
  160. - static void HorizontalScroll();
  161.   static void VerticalScroll();
  162.   static void Page();
  163.   static void InitializeHook();
  164.   static void Realize();
  165.   static void Resize();
  166.   static void ResetThumb();
  167. --- 100,111 ----
  168.    *
  169.    ****************************************************************/
  170.   
  171.   static Boolean ScrollVerticalText();
  172.   static void VerticalThumb();
  173.   static void VerticalScroll();
  174.   static void Page();
  175.   static void InitializeHook();
  176. + static void Initialize();
  177.   static void Realize();
  178.   static void Resize();
  179.   static void ResetThumb();
  180. ***************
  181. *** 114,120 ****
  182.   static void Redisplay();
  183.   static void ChildExpose();
  184.   static Boolean SetValues();
  185. - static int MergeArglists();
  186.   static Boolean Layout();
  187.   static XtGeometryResult GeometryManager();
  188.   static void ChangeManaged();
  189. --- 112,117 ----
  190. ***************
  191. *** 133,139 ****
  192.       /* class_initialize   */    NULL,
  193.       /* class_part_init    */    NULL,
  194.       /* class_inited       */    FALSE,
  195. !     /* initialize         */    NULL,
  196.       /* initialize_hook    */    InitializeHook,
  197.       /* realize            */    Realize,
  198.       /* actions            */    actions,
  199. --- 130,136 ----
  200.       /* class_initialize   */    NULL,
  201.       /* class_part_init    */    NULL,
  202.       /* class_inited       */    FALSE,
  203. !     /* initialize         */    Initialize,
  204.       /* initialize_hook    */    InitializeHook,
  205.       /* realize            */    Realize,
  206.       /* actions            */    actions,
  207. ***************
  208. *** 185,190 ****
  209. --- 182,189 ----
  210.   /*    Function Name: Layout
  211.    *    Description: This function lays out the scroll_by_line widget.
  212.    *    Arguments: w - the scroll_by_line widget.
  213. +  *                 key - a boolean: if true then resize the widget to the child
  214. +  *                                  if false the resize children to fit widget.
  215.    *    Returns: TRUE if successful.
  216.    */
  217.   
  218. ***************
  219. *** 196,219 ****
  220.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  221.     Dimension width,height;    /* The size that the widget would like to be */
  222.     XtGeometryResult answer;    /* the answer from the parent. */
  223. !   Widget hbar,vbar,child;    /* The three children of this 
  224. !                        scrolled widget. */
  225.     int vbar_x,vbar_y;        /* The locations of the various elements. */
  226. !   int hbar_x,hbar_y;
  227. !   int child_x,child_y;
  228. !   int c_width,c_height;
  229.     Boolean make_bar;
  230.   
  231.     vbar = sblw->composite.children[0];
  232. !   hbar = sblw->composite.children[1];
  233. !   child = sblw->composite.children[2];
  234.     height = sblw->core.height;
  235.     width = sblw->core.width;
  236.   
  237.   /* set the initial scroll bar positions. */
  238.   
  239. !   vbar_x = vbar_y = 0;
  240. !   hbar_x = hbar_y = 0;
  241.   
  242.   /* Should I allow the vertical scrollbar to be seen */
  243.   
  244. --- 195,214 ----
  245.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  246.     Dimension width,height;    /* The size that the widget would like to be */
  247.     XtGeometryResult answer;    /* the answer from the parent. */
  248. !   Widget vbar,child;        /* The two children of this scrolled widget. */
  249.     int vbar_x,vbar_y;        /* The locations of the various elements. */
  250. !   int child_x;
  251. !   int c_width;
  252.     Boolean make_bar;
  253.   
  254.     vbar = sblw->composite.children[0];
  255. !   child = sblw->composite.children[1];
  256.     height = sblw->core.height;
  257.     width = sblw->core.width;
  258.   
  259.   /* set the initial scroll bar positions. */
  260.   
  261. !   vbar_x = vbar_y = - vbar->core.border_width;
  262.   
  263.   /* Should I allow the vertical scrollbar to be seen */
  264.   
  265. ***************
  266. *** 238,258 ****
  267.        else
  268.          c_width = width - vbar->core.width -2 * vbar->core.border_width;
  269.   
  270. ! /* Put Scrollbar on right side if scrolled window? */
  271.   
  272.        if (sblw->scroll_by_line.use_right) {
  273.          vbar_x = width - vbar->core.width - 2 * vbar->core.border_width;
  274.          child_x = 0;
  275.        }
  276. !      else {
  277. !        child_x = vbar->core.width + 2 * vbar->core.border_width;
  278. !        vbar_x = 0;
  279. !      }
  280.      }
  281.      else {
  282.        /* Make the scroll bar dissappear, note how scroll bar is always there,
  283.           sometimes it is just that we cannot see them. */
  284. !      vbar_x = - vbar->core.width - 10;
  285.        child_x = 0;
  286.        if (key)
  287.          width = child->core.width;
  288. --- 233,251 ----
  289.        else
  290.          c_width = width - vbar->core.width -2 * vbar->core.border_width;
  291.   
  292. !      /* Put Scrollbar on right side if scrolled window? */
  293.   
  294.        if (sblw->scroll_by_line.use_right) {
  295.          vbar_x = width - vbar->core.width - 2 * vbar->core.border_width;
  296.          child_x = 0;
  297.        }
  298. !      else 
  299. !        child_x = vbar->core.width + vbar->core.border_width;
  300.      }
  301.      else {
  302.        /* Make the scroll bar dissappear, note how scroll bar is always there,
  303.           sometimes it is just that we cannot see them. */
  304. !      vbar_x = - vbar->core.width - 2 * vbar->core.border_width - 10;
  305.        child_x = 0;
  306.        if (key)
  307.          width = child->core.width;
  308. ***************
  309. *** 260,356 ****
  310.          c_width = width;
  311.      }
  312.   
  313. ! /* set the horizontal bar position. */
  314.   
  315. ! /* should we allow the horiz. scroll bar. */
  316.   
  317. !    if (sblw->scroll_by_line.allow_horiz && (child->core.width >= width ||
  318. !                     sblw->scroll_by_line.force_bars)) {
  319. !      if (key)
  320. !        height = child->core.height + hbar->core.height + 
  321. !             2 * hbar->core.border_width;
  322. !      else
  323. !        c_height = height - hbar->core.height - 2 * hbar->core.border_width;
  324.   
  325. !      hbar_x = child_x;
  326.   
  327. ! /* Should we put the scroll bar on the bottom?? */
  328.   
  329. !      if (sblw->scroll_by_line.use_bottom) {
  330. !        hbar_y = height - hbar->core.height - 2 * hbar->core.border_width;
  331. !        child_y = 0;
  332. !      }
  333. !      else {
  334. !        child_y = hbar->core.height + 2 * hbar->core.border_width;
  335. !        vbar_y = child_y;
  336. !        hbar_y = 0;
  337. !      }
  338. !    }
  339. !    else {
  340. !      /* make this scroll bar disappear. */
  341. !      hbar_y = - hbar->core.height - 10;
  342. !      child_y = 0;
  343. !      if (key)
  344. !        height = child->core.height;
  345. !      else
  346. !        c_height = height;
  347. !    }
  348.   
  349. -  /* if the windows are realized we have to move them. */
  350. -    if (XtIsRealized( (Widget) sblw)) {
  351. -      XtMoveWidget(hbar,hbar_x,hbar_y);
  352. -      XtMoveWidget(vbar,vbar_x,vbar_y);
  353. -      XtMoveWidget(child,child_x,child_y);
  354. -  /* resize the children to be the correct height or width. */
  355. -      XtResizeWidget(vbar,vbar->core.width,height - 
  356. -             2 * vbar->core.border_width - vbar_y,
  357. -             vbar->core.border_width);
  358. -      XtResizeWidget(hbar,width - hbar_x - 
  359. -             2 * hbar->core.border_width,
  360. -             hbar->core.height,hbar->core.border_width);
  361. -      if (!key)
  362. -        XtResizeWidget(child, (Cardinal) c_width, (Cardinal) c_height,
  363. -               child->core.border_width);
  364. -    }
  365. - /* 
  366. -  * If they are not realized we do not need to move them then just set their 
  367. -  * core values, this saves a bit of time. 
  368. -  */
  369. -   else {
  370. -     hbar->core.x = hbar_x;
  371. -     hbar->core.y = hbar_y;
  372. -     vbar->core.x = vbar_x;
  373. -     vbar->core.y = vbar_y;
  374. -     child->core.x = child_x;
  375. -     child->core.y = child_y;
  376. - /* resize the scrollbars to be the correct height or width. */
  377. -     XtResizeWidget(vbar,vbar->core.width,height - 
  378. -                2 * vbar->core.border_width - vbar_y,
  379. -                vbar->core.border_width);
  380. -     XtResizeWidget(hbar,width - hbar_x - 
  381. -                2 * hbar->core.border_width,
  382. -                hbar->core.height,hbar->core.border_width);
  383. -     if (!key) { 
  384. -       child->core.width = c_width;
  385. -       child->core.height = c_height;
  386. -     }
  387. -   }    
  388. -   height = height;
  389. -   width = width;
  390. - /* set the thumb size to be correct. */
  391.     ResetThumb( (Widget) sblw);
  392.   
  393.     answer = XtMakeResizeRequest( (Widget) sblw, width, height, &width, &height);
  394. --- 253,273 ----
  395.          c_width = width;
  396.      }
  397.   
  398. !  /* Move child and v_bar to correct location. */
  399.   
  400. !   XtMoveWidget(vbar, vbar_x, vbar_y);
  401. !   XtMoveWidget(child, child_x, 0);
  402.   
  403. !   /* resize the children to be the correct height or width. */
  404.   
  405. !   XtResizeWidget(vbar, vbar->core.width, height, vbar->core.border_width);
  406.   
  407. !   if (!key)
  408. !     XtResizeWidget(child, (Cardinal) (c_width - 20), (Cardinal) height,
  409. !            child->core.border_width);
  410.   
  411. !   /* set the thumb size to be correct. */
  412.   
  413.     ResetThumb( (Widget) sblw);
  414.   
  415.     answer = XtMakeResizeRequest( (Widget) sblw, width, height, &width, &height);
  416. ***************
  417. *** 378,388 ****
  418.   {
  419.     float shown;
  420.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  421. !   Widget child,vbar,hbar;
  422.   
  423.     vbar = sblw->composite.children[0];
  424. !   hbar = sblw->composite.children[1];
  425. !   child = sblw->composite.children[2];
  426.   
  427.   /* vertical */
  428.   
  429. --- 295,304 ----
  430.   {
  431.     float shown;
  432.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  433. !   Widget child,vbar;
  434.   
  435.     vbar = sblw->composite.children[0];
  436. !   child = sblw->composite.children[1];
  437.   
  438.   /* vertical */
  439.   
  440. ***************
  441. *** 392,409 ****
  442.       shown = 1.0;
  443.   
  444.     XtScrollBarSetThumb( vbar, (float) -1, shown );
  445. - /* horizontal */
  446. -   shown = (float) child->core.width / (float) child->core.width;
  447. -   XtScrollBarSetThumb( hbar, (float) -1, shown );
  448.   }
  449.   
  450.   /*
  451.    *
  452.    * Geometry Manager - If the height of width is changed then try a new layout.
  453. ! *                    else dissallow the requwest.
  454. ! *
  455.    */
  456.   
  457.   /*ARGSUSED*/
  458. --- 308,320 ----
  459.       shown = 1.0;
  460.   
  461.     XtScrollBarSetThumb( vbar, (float) -1, shown );
  462.   }
  463.   
  464.   /*
  465.    *
  466.    * Geometry Manager - If the height of width is changed then try a new layout.
  467. !  *                    else dissallow the requwest.
  468. !  *
  469.    */
  470.   
  471.   /*ARGSUSED*/
  472. ***************
  473. *** 440,446 ****
  474.    * then I call the redisplay routine.
  475.    */
  476.   
  477. !   Redisplay(w->core.parent,event);
  478.   } /* ChildExpose */
  479.   
  480.   /*
  481. --- 351,359 ----
  482.    * then I call the redisplay routine.
  483.    */
  484.   
  485. !   if ((event->type == Expose) || (event->type == GraphicsExpose))
  486. !     Redisplay(w->core.parent, event, NULL);
  487.   } /* ChildExpose */
  488.   
  489.   /*
  490. ***************
  491. *** 448,456 ****
  492.    */
  493.   
  494.   /* ARGSUSED */
  495. ! static void Redisplay(w, event)
  496.   Widget w;
  497.   XEvent *event;
  498.   {
  499.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  500.   
  501. --- 361,370 ----
  502.    */
  503.   
  504.   /* ARGSUSED */
  505. ! static void Redisplay(w, event, region)
  506.   Widget w;
  507.   XEvent *event;
  508. + Region region;
  509.   {
  510.     ScrollByLineWidget sblw = (ScrollByLineWidget) w;
  511.   
  512. ***************
  513. *** 543,549 ****
  514.    * of scrolling has been turned off. 
  515.    */
  516.   
  517. !    if (vbar->core.x < 0)
  518.        return;
  519.   
  520.      switch ( direction ) {
  521. --- 457,463 ----
  522.    * of scrolling has been turned off. 
  523.    */
  524.   
  525. !    if (vbar->core.x < - vbar->core.border_width)
  526.        return;
  527.   
  528.      switch ( direction ) {
  529. ***************
  530. *** 555,561 ****
  531.      case 'b':
  532.      case 'B':
  533.        /* move one page backward */
  534. !      VerticalScroll(vbar,NULL, (int)  - vbar->core.height);
  535.        break;
  536.      case 'L':
  537.      case 'l':
  538. --- 469,475 ----
  539.      case 'b':
  540.      case 'B':
  541.        /* move one page backward */
  542. !      VerticalScroll(vbar,NULL,  - (int) vbar->core.height);
  543.        break;
  544.      case 'L':
  545.      case 'l':
  546. ***************
  547. *** 595,602 ****
  548.     ScrollByLineStruct sblw_struct;
  549.     Boolean move_thumb = FALSE;
  550.   
  551. -   child = sblw->composite.children[2];
  552.     vbar =  sblw->composite.children[0];
  553.   
  554.     num_lines =  child->core.height / sblw->scroll_by_line.font_height;
  555.   
  556. --- 509,516 ----
  557.     ScrollByLineStruct sblw_struct;
  558.     Boolean move_thumb = FALSE;
  559.   
  560.     vbar =  sblw->composite.children[0];
  561. +   child = sblw->composite.children[1];
  562.   
  563.     num_lines =  child->core.height / sblw->scroll_by_line.font_height;
  564.   
  565. ***************
  566. *** 613,618 ****
  567. --- 527,534 ----
  568.       max_lines = sblw->scroll_by_line.lines -
  569.        child->core.height / sblw->scroll_by_line.font_height;
  570.   
  571. +     if (max_lines < 0) max_lines = 0;
  572.       if ( new_line > max_lines ) {
  573.         new_line = max_lines;
  574.         move_thumb = TRUE;
  575. ***************
  576. *** 787,973 ****
  577.   
  578.   }
  579.   
  580. ! /*
  581. !  * I have not thought out the horizontal scrolling yet, I am not sure what 
  582. !  * should be done here.  This code is questionable.
  583. !  */
  584. !  
  585. ! /*    Function Name: HorizontalThumb
  586. !  *    Description: This function moves the postition of the interior window
  587. !  *                   as the vertical scroll bar is moved.
  588. !  *    Arguments: w - the scrollbar widget.
  589. !  *                 junk - not used.
  590. !  *                 percent - the position of the scrollbar.
  591. !  *    Returns: none.
  592. !  */
  593. ! static void
  594. ! HorizontalThumb(w,junk,percent)
  595. ! Widget w;
  596. ! caddr_t junk;
  597. ! float *percent;
  598.   {
  599. -   int x, y;
  600. -   Widget child,vbar;
  601. -   ScrollByLineWidget sblw = (ScrollByLineWidget) w->core.parent;
  602. -   /* reposition the client window (child[2]) */
  603. -   vbar =  sblw->composite.children[0];
  604. -   child = sblw->composite.children[2];
  605. -   x = (int) ( (0.0 - (*percent)) * ((float) child->core.width));
  606. -   y = child->core.y;
  607. - /* 
  608. -  * if there is a vertical scrollbar and it is on the left then 
  609. -  * allow room for it .
  610. -  */
  611. -   if (vbar->core.x == 0)
  612. -     x += vbar->core.width + 2 * vbar->core.border_width;
  613. -   XtMoveWidget(child,x,y);
  614. - }
  615. - /*    Function Name: HorizontalScroll
  616. -  *    Description: This function moves the postition of the interior window
  617. -  *                   as the horizontal scroll bar is moved.
  618. -  *    Arguments: w - the scrollbar widget.
  619. -  *                 junk - not used.
  620. -  *                 pos - the position of the cursor.
  621. -  *    Returns: none.
  622. -  */
  623. - static void
  624. - HorizontalScroll(w,junk,pos)
  625. - Widget w;
  626. - caddr_t junk;
  627. - int pos;
  628. - {
  629. -   int x, y, min_x;
  630. -   float location;
  631. -   Widget child,vbar,hbar;
  632. -   ScrollByLineWidget sblw = (ScrollByLineWidget) w->core.parent;
  633. -   /* reposition the client window (child[2]) */
  634. -   vbar =  sblw->composite.children[0];
  635. -   hbar =  sblw->composite.children[1];
  636. -   child = sblw->composite.children[2];
  637. -   x = child->core.x - pos;
  638. -   y = child->core.y;
  639. -   
  640. - /* 
  641. -  * Keep us in bounds.
  642. -  */
  643. -   if ( x > 0 ) x = 0;
  644. -   min_x = - (child->core.width - hbar->core.width - 
  645. -          2 * vbar->core.border_width);
  646. -   if (vbar->core.y > 0)        /* vertical scrollbar is on right.*/
  647. -     min_x -=  vbar->core.width +  2 * vbar->core.border_width;
  648. -   if ( x < min_x ) x = min_x;
  649. - /* reposition the thumb */
  650. -   location = 0.0 - (float) y / (float) child->core.width; 
  651. -   XtScrollBarSetThumb( hbar, location , (float) -1 );
  652. -   
  653. - /* 
  654. -  * if there is a vertical scrollbar and it is on the left then 
  655. -  * allow room for it .
  656. -  */
  657. -   if (vbar->core.x == 0)
  658. -     y += vbar->core.width + 2 * vbar->core.border_width;
  659. -     
  660. -   XtMoveWidget(child,x,y);    /* he's my child so I can move him. */
  661. - }
  662. - static void InitializeHook(new, args, num_args)
  663. -     ScrollByLineWidget new;
  664. -     ArgList args;
  665. -     Cardinal *num_args;
  666. - {
  667.     ScrollByLineWidget sblw = (ScrollByLineWidget) new;
  668. -   Widget window;        /* Window widget. */
  669. -   Arg arglist[50];        /* Must be large enough for the 
  670. -                  arglist from the scrolled widget to 
  671. -                  be added to it. */
  672. -   Cardinal scrollbar_num;    /* the number of scrollbar args. */
  673. -   Cardinal window_num;        /* the number of window args. */
  674.     
  675. !   static XtCallbackRec scrollcallback[] = { /* The scroll callback function. */
  676. !     { NULL, NULL },
  677. !     { NULL, NULL },
  678. !   };
  679. !   static XtCallbackRec thumbcallback[] = { /* The thumb callback function. */
  680. !     { NULL, NULL },
  681. !     { NULL, NULL },
  682. !   };
  683.   
  684. -   sblw->scroll_by_line.line_pointer = 0; /* initial point to line 0. */
  685.     if (sblw->core.height <= 0)
  686.       sblw->core.height = DEFAULT_HEIGHT;
  687.     if (sblw->core.width <= 0)
  688.       sblw->core.width = DEFAULT_WIDTH;
  689.   
  690. !   scrollbar_num = 0;  
  691. !   XtSetArg(arglist[scrollbar_num], XtNheight, 10); /* changed in layout. */
  692. !   scrollbar_num++;
  693. !   XtSetArg(arglist[scrollbar_num], XtNwidth, 16);
  694. !   scrollbar_num++;
  695. !   XtSetArg(arglist[scrollbar_num], XtNorientation, XtorientVertical);
  696. !   scrollbar_num++;
  697. !   thumbcallback[0].callback = VerticalThumb;  
  698. !   scrollcallback[0].callback = VerticalScroll;
  699. !   XtSetArg(arglist[scrollbar_num], XtNjumpProc, thumbcallback);
  700. !   scrollbar_num++;
  701. !   XtSetArg(arglist[scrollbar_num], XtNscrollProc, scrollcallback);
  702. !   scrollbar_num++;
  703.   
  704. ! /* 
  705. !  * Merge the argument lists so but have the scrollbar arglist take 
  706. !  * control when there is a discrepency this causes us to get the
  707. !  * correct height and width.
  708. !  */
  709.   
  710. -   scrollbar_num = MergeArglists(args, *num_args,arglist,scrollbar_num);
  711. -   XtCreateManagedWidget("Vertical Scroll Bar",
  712. -          scrollbarWidgetClass, (Widget) sblw,arglist,scrollbar_num);
  713. -   scrollbar_num = 0;  
  714. -   XtSetArg(arglist[scrollbar_num], XtNwidth, 10); /* changed in layout. */
  715. -   scrollbar_num++;
  716. -   XtSetArg(arglist[scrollbar_num], XtNheight, 16);
  717. -   scrollbar_num++;
  718. -   XtSetArg(arglist[scrollbar_num], XtNorientation, XtorientHorizontal);
  719. -   scrollbar_num++;
  720. -   thumbcallback[0].callback = HorizontalThumb;
  721. -   scrollcallback[0].callback = HorizontalScroll;
  722. -   XtSetArg(arglist[scrollbar_num], XtNjumpProc, thumbcallback);
  723. -   scrollbar_num++;
  724. -   XtSetArg(arglist[scrollbar_num], XtNscrollProc, scrollcallback);
  725. -   scrollbar_num++;
  726. - /* 
  727. -  * Merge the argument lists so but have the scrollbar arglist take 
  728. -  * control when there is a discrepency this causes us to get the
  729. -  * correct height and width.
  730. -  */
  731. -   scrollbar_num = MergeArglists(args, *num_args,arglist,scrollbar_num);
  732. -   XtCreateManagedWidget("Horizontal Scroll Bar",
  733. -          scrollbarWidgetClass, (Widget) sblw,arglist,scrollbar_num);
  734.     window_num = 0;  
  735.     XtSetArg(arglist[window_num], XtNwidth, sblw->scroll_by_line.inner_width); 
  736.     window_num++;
  737. --- 703,739 ----
  738.   
  739.   }
  740.   
  741. ! static void 
  742. ! Initialize(req, new)
  743. ! Widget req, new;
  744.   {
  745.     ScrollByLineWidget sblw = (ScrollByLineWidget) new;
  746.     
  747. !   sblw->scroll_by_line.line_pointer = 0; /* initially point to line 0. */
  748.   
  749.     if (sblw->core.height <= 0)
  750.       sblw->core.height = DEFAULT_HEIGHT;
  751.     if (sblw->core.width <= 0)
  752.       sblw->core.width = DEFAULT_WIDTH;
  753. + } /* Initialize. */
  754.   
  755. ! static void 
  756. ! InitializeHook(new, args, num_args)
  757. ! ScrollByLineWidget new;
  758. ! ArgList args;
  759. ! Cardinal *num_args;
  760. ! {
  761. !   ScrollByLineWidget sblw = (ScrollByLineWidget) new;
  762. !   Widget window, s_bar;        /* Window widget, and scollbar. */
  763. !   Arg arglist[10];        /* an arglist. */
  764. !   ArgList merged_list, XtMergeArgLists(); /* The merged arglist. */
  765. !   Cardinal window_num, merged_num; /* The number of window args. */
  766.   
  767. !   s_bar = XtCreateManagedWidget("verticalScrollBar", scrollbarWidgetClass,
  768. !                 (Widget) sblw, args, *num_args);
  769. !   XtAddCallback(s_bar, XtNjumpProc, VerticalThumb, NULL);
  770. !   XtAddCallback(s_bar, XtNscrollProc, VerticalScroll, NULL);
  771.   
  772.     window_num = 0;  
  773.     XtSetArg(arglist[window_num], XtNwidth, sblw->scroll_by_line.inner_width); 
  774.     window_num++;
  775. ***************
  776. *** 975,988 ****
  777.     window_num++;
  778.     XtSetArg(arglist[window_num], XtNborderWidth, 0);
  779.     window_num++;  
  780.     
  781. !   window = XtCreateWidget("Window with file",widgetClass,(Widget) sblw,arglist,
  782. !               window_num);
  783.     XtManageChild(window);
  784.   
  785. ! /* We want expose events for this window also. */
  786.   
  787. !   XtAddEventHandler(window, (Cardinal) ExposureMask, FALSE, ChildExpose, NULL);
  788.     
  789.   } /* InitializeHook */
  790.   
  791. --- 741,764 ----
  792.     window_num++;
  793.     XtSetArg(arglist[window_num], XtNborderWidth, 0);
  794.     window_num++;  
  795. + /* 
  796. +  * I hope this will cause my args to override those passed to the SBL widget.
  797. +  */
  798.     
  799. !   merged_list = XtMergeArgLists(args, *num_args, arglist, window_num);
  800. !   merged_num = *num_args + window_num;
  801. !   window = XtCreateWidget("windowWithFile",widgetClass,(Widget) sblw,
  802. !               merged_list, merged_num);
  803.     XtManageChild(window);
  804. +   XtFree(merged_list);        /* done, free it. */
  805.   
  806. ! /*
  807. !  * We want expose (and graphic exposuer) events for this window also. 
  808. !  */
  809.   
  810. !   XtAddEventHandler(window, (Cardinal) ExposureMask, TRUE, ChildExpose, NULL);
  811.     
  812.   } /* InitializeHook */
  813.   
  814. ***************
  815. *** 1023,1078 ****
  816.   
  817.   } /* Set Values */
  818.   
  819. - /*    Function Name: MergeArglists
  820. -  *    Description: This function merges two arglists.
  821. -  *    Arguments: from,num_from - the number and list of args for the source.
  822. -  *                 to,num_to - the number and list of argument for the
  823. -  *                             destination.
  824. -  *    Returns: new number of argument in to.
  825. -  */
  826. - /* Note: This function will be very unhappy with you if 'to' is not
  827. -  *       large enough to contain 'from', you will end up with pointers 
  828. -  *       in space.
  829. -  */
  830. - static int
  831. - MergeArglists(from,num_from,to,num_to)
  832. - Arg from[],to[];
  833. - Cardinal num_from,num_to;
  834. - {
  835. -   int i,j;            /* a counter. */
  836. - /* When there are two similar values ignore the from value. */
  837. -   i = 0;
  838. -   while ( i < num_from ) {    
  839. -     j = 0;
  840. -     while ( j < num_to ) {
  841. -       if ( !strcmp(from[i].name,to[j].name) ) {
  842. -     /* if they are the same then goto next on the from list,
  843. -        i.e. ignore this entry, do not add to to list. */
  844. -     i++;
  845. -     if ( i > num_from)
  846. -       j = num_to + 100;
  847. -     else {
  848. -       j = 0;
  849. -       continue;
  850. -     }
  851. -       }
  852. -       j++;
  853. -     }
  854. -     /* add to to list */
  855. -     if (j < num_to + 100) {
  856. -       to[num_to].value = from[i].value;
  857. -       to[num_to].name = from[i].name;
  858. -       num_to++;
  859. -       i++;
  860. -     }
  861. -   }
  862. -   return(num_to);
  863. - }
  864.   /* Public Routines. */
  865.   
  866.   /*    Function Name: XtScrollByLineWidget()
  867. --- 799,804 ----
  868. ***************
  869. *** 1087,1093 ****
  870.   {
  871.     ScrollByLineWidget sblw = (ScrollByLineWidget) w; /* the sblw widget. */
  872.     
  873. !   return(sblw->composite.children[2]);
  874.   }
  875.   
  876.   /*    Function Name: XtResetScrollByLine
  877. --- 813,819 ----
  878.   {
  879.     ScrollByLineWidget sblw = (ScrollByLineWidget) w; /* the sblw widget. */
  880.     
  881. !   return(sblw->composite.children[1]);
  882.   }
  883.   
  884.   /*    Function Name: XtResetScrollByLine
  885. ***************
  886. *** 1114,1118 ****
  887.                (float) sblw->scroll_by_line.lines; 
  888.     XtScrollBarSetThumb( vbar, location , (float) -1 );
  889.   
  890. !   ResetThumb(w);
  891.   }
  892. --- 840,844 ----
  893.                (float) sblw->scroll_by_line.lines; 
  894.     XtScrollBarSetThumb( vbar, location , (float) -1 );
  895.   
  896. !   Layout(w, FALSE);        /* see if new layout is required. */
  897.   }
  898. *** /tmp/,RCSt1a17182    Fri Jan  6 18:56:42 1989
  899. --- clients/xman/handler.c    Fri Jan  6 18:42:02 1989
  900. ***************
  901. *** 1,7 ****
  902.   /*
  903.    * xman - X window system manual page display program.
  904.    *
  905. !  * $XConsortium: handler.c,v 1.2 88/09/06 17:47:50 jim Exp $
  906.    *
  907.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  908.    *
  909. --- 1,7 ----
  910.   /*
  911.    * xman - X window system manual page display program.
  912.    *
  913. !  * $XConsortium: handler.c,v 1.3 89/01/06 18:42:00 kit Exp $
  914.    *
  915.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  916.    *
  917. ***************
  918. *** 20,26 ****
  919.    */
  920.   
  921.   #if ( !defined(lint) && !defined(SABER))
  922. !   static char rcs_version[] = "$Athena: handler.c,v 4.0 88/08/31 22:11:58 kit Exp $";
  923.   #endif
  924.   
  925.   #include "globals.h"
  926. --- 20,26 ----
  927.    */
  928.   
  929.   #if ( !defined(lint) && !defined(SABER))
  930. !   static char rcs_version[] = "$Athena: handler.c,v 4.6 89/01/06 12:17:27 kit Exp $";
  931.   #endif
  932.   
  933.   #include "globals.h"
  934. ***************
  935. *** 84,91 ****
  936.    * I did not have a two state or toggle widget, which is the way this
  937.    * should really be done.  1/22/88 - CDP.
  938.    */
  939. -     ChangeLabel(man_globals->label,
  940. -         man_globals->section_name[man_globals->current_directory]);
  941.       if (man_globals->both_shown == TRUE) {
  942.         label_str = SHOW_BOTH;
  943.         if (man_globals->dir_shown)
  944. --- 84,89 ----
  945. ***************
  946. *** 98,104 ****
  947.         Widget dir = man_globals->manpagewidgets.directory;
  948.   
  949.         label_str = SHOW_ONE;
  950. !       XtPanedSetMinMax(dir,directory_height,directory_height);
  951.         if (!man_globals->dir_shown) {
  952.       XtUnmanageChild(manpage);
  953.       XtManageChild(dir);
  954. --- 96,103 ----
  955.         Widget dir = man_globals->manpagewidgets.directory;
  956.   
  957.         label_str = SHOW_ONE;
  958. !       XtPanedSetMinMax(dir, resources.directory_height, 
  959. !                resources.directory_height);
  960.         if (!man_globals->dir_shown) {
  961.       XtUnmanageChild(manpage);
  962.       XtManageChild(dir);
  963. ***************
  964. *** 116,121 ****
  965. --- 115,125 ----
  966.    * is up so very little time is wasted in the extra popdown call later.
  967.    */
  968.       XtPopdown( XtParent(XtParent(w)) );
  969. +     if (man_globals->dir_shown)
  970. +       ChangeLabel(man_globals->label,
  971. +           man_globals->section_name[man_globals->current_directory]);
  972. +     else
  973. +       ChangeLabel(man_globals->label, man_globals->manpage_title);
  974.       ChangeLabel(man_globals->both_shown_button, label_str);
  975.       /* if both are shown there is no need to switch between the two. */
  976.       XtSetSensitive(man_globals->put_up_manpage,!man_globals->both_shown);
  977. ***************
  978. *** 156,161 ****
  979. --- 160,167 ----
  980.   
  981.   #define OFF_OF_TOP 25
  982.   
  983. + /* ARGSUSED */
  984.   void
  985.   PopUpMenu(w,junk,event)
  986.   Widget w;
  987. ***************
  988. *** 188,193 ****
  989. --- 194,201 ----
  990.    *    Returns: none
  991.    */
  992.   
  993. + /* ARGSUSED */
  994.   void
  995.   PopDown(w,junk,event)
  996.   Widget w;
  997. ***************
  998. *** 226,232 ****
  999.     else if ( !strcmp(Name(w),CANCEL) ) 
  1000.       file = NULL;
  1001.     else 
  1002. !     PrintWarning("Unknown widget");
  1003.   
  1004.     /* popdown the search widget */
  1005.   
  1006. --- 234,240 ----
  1007.     else if ( !strcmp(Name(w),CANCEL) ) 
  1008.       file = NULL;
  1009.     else 
  1010. !     PrintError("Unknown widget, in Search Box.");
  1011.   
  1012.     /* popdown the search widget */
  1013.   
  1014. ***************
  1015. *** 254,270 ****
  1016.     InitManpage(man_globals,man_globals->manpagewidgets.manpage,file);
  1017.     fclose(file);
  1018.     
  1019. !   if (!man_globals->both_shown) {
  1020.       XtUnmanageChild(man_globals->manpagewidgets.directory);
  1021.       XtManageChild(man_globals->manpagewidgets.manpage);
  1022. -   }
  1023. -   
  1024. -   XtSetSensitive(man_globals->both_shown_button,TRUE);
  1025. -   if (!man_globals->both_shown) {
  1026.       XtSetSensitive(man_globals->put_up_manpage,TRUE); 
  1027.       ChangeLabel(man_globals->label,man_globals->manpage_title);
  1028.       man_globals->dir_shown = FALSE;
  1029.     }
  1030.     MakeLong( XtParent(man_globals->both_shown_button) );
  1031.     XtResetScrollByLine(man_globals->manpagewidgets.manpage);
  1032.   }
  1033. --- 262,280 ----
  1034.     InitManpage(man_globals,man_globals->manpagewidgets.manpage,file);
  1035.     fclose(file);
  1036.     
  1037. !   if (man_globals->both_shown) {
  1038. !     ChangeLabel(man_globals->label, 
  1039. !         man_globals->section_name[man_globals->current_directory]);
  1040. !   }
  1041. !   else {
  1042.       XtUnmanageChild(man_globals->manpagewidgets.directory);
  1043.       XtManageChild(man_globals->manpagewidgets.manpage);
  1044.       XtSetSensitive(man_globals->put_up_manpage,TRUE); 
  1045.       ChangeLabel(man_globals->label,man_globals->manpage_title);
  1046.       man_globals->dir_shown = FALSE;
  1047.     }
  1048. +   XtSetSensitive(man_globals->both_shown_button,TRUE);
  1049.     MakeLong( XtParent(man_globals->both_shown_button) );
  1050.     XtResetScrollByLine(man_globals->manpagewidgets.manpage);
  1051.   }
  1052. ***************
  1053. *** 309,314 ****
  1054. --- 319,326 ----
  1055.    *    Returns: none.
  1056.    */
  1057.   
  1058. + /* ARGSUSED */
  1059.   void
  1060.   GotoManpage(w, global_pointer, event)
  1061.   Widget w;
  1062. ***************
  1063. *** 350,358 ****
  1064.     ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer;
  1065.     XtListReturnStruct * ret_struct = (XtListReturnStruct *) ret_val;
  1066.   
  1067. !   file = FindFilename(man_globals, ret_struct->string,
  1068. !               man_globals->current_directory,
  1069. !      &(manual[man_globals->current_directory].entries[ret_struct->index]));
  1070.     PutUpManpage(man_globals, file);
  1071.   }
  1072.   
  1073. --- 362,369 ----
  1074.     ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer;
  1075.     XtListReturnStruct * ret_struct = (XtListReturnStruct *) ret_val;
  1076.   
  1077. !   file = FindFilename(man_globals,
  1078. !      manual[man_globals->current_directory].entries[ret_struct->index]);
  1079.     PutUpManpage(man_globals, file);
  1080.   }
  1081.   
  1082. ***************
  1083. *** 378,391 ****
  1084.     int current_box;
  1085.   
  1086.     menu_struct = (MenuCallbackStruct *) pointer;
  1087.     man_globals = (ManpageGlobals *) menu_struct->data;
  1088.   
  1089. -   /* The callback numbers go from 0 to n - 1 but I want from 1 to n */
  1090.     number = menu_struct->number;
  1091. -   number++;
  1092.     current_box = man_globals->current_directory;
  1093.   
  1094.     /* We have used this guy, pop down the menu. */
  1095. --- 389,397 ----
  1096. ***************
  1097. *** 392,407 ****
  1098.     
  1099.     if (number != current_box) {
  1100.       /* This is the only one that we know has a parent. */
  1101. !     parent = XtParent(man_globals->manpagewidgets.box[1]);
  1102.   
  1103.       MakeDirectoryBox(man_globals, parent,
  1104.                man_globals->manpagewidgets.box + number, number);
  1105.       XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
  1106.       XtManageChild(man_globals->manpagewidgets.box[number]);
  1107. !     
  1108.       man_globals->current_directory = number;
  1109.     }
  1110. -   ChangeLabel(man_globals->label, man_globals->section_name[number]);
  1111.   
  1112.     XtPopdown( XtParent(XtParent(w)) );
  1113.   
  1114. --- 398,414 ----
  1115.     
  1116.     if (number != current_box) {
  1117.       /* This is the only one that we know has a parent. */
  1118. !     parent = XtParent(man_globals->manpagewidgets.box[INITIAL_DIR]);
  1119.   
  1120.       MakeDirectoryBox(man_globals, parent,
  1121.                man_globals->manpagewidgets.box + number, number);
  1122.       XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
  1123.       XtManageChild(man_globals->manpagewidgets.box[number]);
  1124. !     XtListUnhighlight(man_globals->manpagewidgets.box[current_box]);
  1125. !     ChangeLabel(man_globals->label, man_globals->section_name[number]);
  1126.       man_globals->current_directory = number;
  1127.     }
  1128.   
  1129.     XtPopdown( XtParent(XtParent(w)) );
  1130.   
  1131. ***************
  1132. *** 422,427 ****
  1133. --- 429,436 ----
  1134.    *    Returns: none
  1135.    */
  1136.   
  1137. + /* ARGSUSED */
  1138.   void
  1139.   SaveCallback(w,global_pointer,junk)
  1140.   Widget w;
  1141. ***************
  1142. *** 453,458 ****
  1143. --- 462,469 ----
  1144.    *                 junk - the callback and closure date are not used.
  1145.    *    Returns: none.
  1146.    */
  1147. + /* ARGSUSED */
  1148.   
  1149.   void
  1150.   ManpageButtonPress(w,global_pointer,event)
  1151. *** /tmp/,RCSt1a17197    Fri Jan  6 18:56:47 1989
  1152. --- clients/xman/main.c    Fri Jan  6 18:42:11 1989
  1153. **************
  1154. *** 1,7 ****
  1155.   /*
  1156.    * xman - X window system manual page display program.
  1157.    *
  1158. !  * $XConsortium: main.c,v 1.3 88/10/20 10:05:04 swick Exp $
  1159.    *
  1160.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  1161.    *
  1162. --- 1,7 ----
  1163.   /*
  1164.    * xman - X window system manual page display program.
  1165.    *
  1166. !  * $XConsortium: main.c,v 1.4 89/01/06 18:42:08 kit Exp $
  1167.    *
  1168.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  1169.    *
  1170. ***************
  1171. *** 20,26 ****
  1172.    */
  1173.   
  1174.   #if ( !defined(lint) && !defined(SABER))
  1175. !   static char rcs_version[] = "$Athena: main.c,v 4.0 88/08/31 22:12:26 kit Exp $";
  1176.   #endif
  1177.   
  1178.   #include "globals.h"
  1179. --- 20,26 ----
  1180.    */
  1181.   
  1182.   #if ( !defined(lint) && !defined(SABER))
  1183. !   static char rcs_version[] = "$Athena: main.c,v 4.5 88/12/19 13:47:28 kit Exp $";
  1184.   #endif
  1185.   
  1186.   #include "globals.h"
  1187. ***************
  1188. *** 31,63 ****
  1189.   
  1190.   static void ArgError();
  1191.   
  1192. ! /* XtOffset() hack for ibmrt BandAidCompiler */
  1193.   
  1194.   static XtResource my_resources[] = {
  1195.     {"manualFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1196. !      (Cardinal) &(fonts.normal), XtRString, MANPAGE_NORMAL},
  1197.     {"manualFontBold", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1198. !      (Cardinal) &(fonts.bold), XtRString, MANPAGE_BOLD},
  1199.     {"manualFontItalic", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1200. !      (Cardinal) &(fonts.italic), XtRString, MANPAGE_ITALIC},
  1201.     {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1202. !      (Cardinal) &(fonts.directory), XtRString, DIRECTORY_NORMAL},
  1203.     {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean),
  1204. !      (Cardinal) &both_shown_initial, XtRString, "False"},
  1205.     {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int),
  1206. !      (Cardinal) &directory_height, XtRString, "150"},  
  1207.     {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor), 
  1208. !      (Cardinal) &(cursors.top), XtRString, XMAN_CURSOR},
  1209.     {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1210. !      (Cardinal) &(cursors.help), XtRString, HELP_CURSOR},
  1211.     {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1212. !      (Cardinal) &(cursors.manpage), XtRString, MANPAGE_CURSOR},
  1213.     {"searchEntryCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1214. !      (Cardinal) &(cursors.search_entry), XtRString, SEARCH_ENTRY_CURSOR},
  1215.     {"helpFile", XtCFile, XtRString, sizeof(char *),
  1216. !      (Cardinal) &(help_file), XtRString, HELPFILE},
  1217.     {"topBox", XtCBoolean, XtRBoolean, sizeof(Boolean),
  1218. !      (Cardinal) &top_box_active, XtRString, "True"},
  1219.   };
  1220.   
  1221.   /*
  1222. --- 31,63 ----
  1223.   
  1224.   static void ArgError();
  1225.   
  1226. ! #define Offset(field) (XtOffset(Xman_Resources *, field))
  1227.   
  1228.   static XtResource my_resources[] = {
  1229.     {"manualFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1230. !      Offset(fonts.normal), XtRString, MANPAGE_NORMAL},
  1231.     {"manualFontBold", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1232. !      Offset(fonts.bold), XtRString, MANPAGE_BOLD},
  1233.     {"manualFontItalic", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1234. !      Offset(fonts.italic), XtRString, MANPAGE_ITALIC},
  1235.     {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
  1236. !      Offset(fonts.directory), XtRString, DIRECTORY_NORMAL},
  1237.     {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean),
  1238. !      Offset(both_shown_initial), XtRString, "False"},
  1239.     {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int),
  1240. !      Offset(directory_height), XtRString, "150"},  
  1241.     {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor), 
  1242. !      Offset(cursors.top), XtRString, XMAN_CURSOR},
  1243.     {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1244. !      Offset(cursors.help), XtRString, HELP_CURSOR},
  1245.     {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1246. !      Offset(cursors.manpage), XtRString, MANPAGE_CURSOR},
  1247.     {"searchEntryCursor", XtCCursor, XtRCursor, sizeof(Cursor),
  1248. !      Offset(cursors.search_entry), XtRString, SEARCH_ENTRY_CURSOR},
  1249.     {"helpFile", XtCFile, XtRString, sizeof(char *),
  1250. !      Offset(help_file), XtRString, HELPFILE},
  1251.     {"topBox", XtCBoolean, XtRBoolean, sizeof(Boolean),
  1252. !      Offset(top_box_active), XtRString, "True"},
  1253.   };
  1254.   
  1255.   /*
  1256. ***************
  1257. *** 85,134 ****
  1258.   char ** argv;
  1259.   int argc;
  1260.   {
  1261. !   Widget top_menu;
  1262. !   top_menu = XtInitialize(TOPBOXNAME,"XMan", 
  1263. !               xman_options, XtNumber(xman_options),
  1264. !               (unsigned int*) &argc,argv);
  1265.     if (argc != 1) {
  1266.       ArgError(argc, argv);
  1267.       exit(42);
  1268.     }
  1269.   
  1270. !   XtGetApplicationResources( (Widget) top_menu, (caddr_t) NULL, 
  1271.                   my_resources, XtNumber(my_resources),
  1272.                   NULL, (Cardinal) 0);
  1273. -   if (!fonts.normal)
  1274. -     XtError("failed to get the manualFontNormal font");
  1275. -   if (!fonts.bold)
  1276. -     fonts.bold = fonts.normal;
  1277. -   if (!fonts.italic)
  1278. -     fonts.italic = fonts.bold;
  1279. -   if (!fonts.directory)
  1280. -     fonts.directory = fonts.normal;
  1281.   
  1282.   #ifdef DEBUG
  1283.     printf("debugging mode\n");
  1284. -   XSynchronize( XtDisplay(top_menu), TRUE);
  1285.   #endif
  1286.   
  1287. !   /* set default width and height. */
  1288.   
  1289. !   default_width = DisplayWidth(XtDisplay(top_menu), 
  1290. !                    XtDisplay(top_menu)->default_screen);
  1291. !   default_width /= 2; 
  1292. !   default_height=DisplayHeight(XtDisplay(top_menu), 
  1293. !                    XtDisplay(top_menu)->default_screen);
  1294.     default_height *= 3;
  1295.     default_height /= 4;
  1296.   
  1297.     sections = Man();
  1298.   
  1299. !   MakeTopMenuWidget(top_menu);    
  1300. !   if (top_box_active) {
  1301. !     XtRealizeWidget(top_menu);
  1302. !     AddCursor(top_menu,cursors.top);
  1303.     }
  1304.     else
  1305.       CreateManpage();
  1306. --- 85,133 ----
  1307.   char ** argv;
  1308.   int argc;
  1309.   {
  1310. !   initial_widget = XtInitialize(NULL, "XMan", 
  1311. !                 xman_options, XtNumber(xman_options),
  1312. !                 (unsigned int*) &argc,argv);
  1313.     if (argc != 1) {
  1314.       ArgError(argc, argv);
  1315.       exit(42);
  1316.     }
  1317.   
  1318. !   XtGetApplicationResources( initial_widget, (caddr_t) &resources, 
  1319.                   my_resources, XtNumber(my_resources),
  1320.                   NULL, (Cardinal) 0);
  1321.   
  1322. +   if (!resources.fonts.normal)
  1323. +     PrintError("Failed to get the manualFontNormal font");
  1324. +   if (!resources.fonts.bold)
  1325. +     resources.fonts.bold = resources.fonts.normal;
  1326. +   if (!resources.fonts.italic)
  1327. +     resources.fonts.italic = resources.fonts.bold;
  1328. +   if (!resources.fonts.directory)
  1329. +     resources.fonts.directory = resources.fonts.normal;
  1330.   #ifdef DEBUG
  1331.     printf("debugging mode\n");
  1332.   #endif
  1333.   
  1334. ! /*
  1335. !  * Set the default width and height.
  1336. !  * I am not real happy with this method, but it will usually do something
  1337. !  * reasonable, if not the "right" thing.  It is not a real big issue since
  1338. !  * it is easy to change the values with resources or command line options.
  1339. !  * NOTE: if you are in a 100 dpi display you will lose.
  1340. !  */
  1341.   
  1342. !   default_width = DEFAULT_WIDTH;
  1343. !   default_height=DisplayHeight(XtDisplay(initial_widget), 
  1344. !                    XtDisplay(initial_widget)->default_screen);
  1345.     default_height *= 3;
  1346.     default_height /= 4;
  1347.   
  1348.     sections = Man();
  1349.   
  1350. !   if (resources.top_box_active) {
  1351. !     MakeTopMenuWidget();    
  1352.     }
  1353.     else
  1354.       CreateManpage();
  1355. ***************
  1356. *** 138,144 ****
  1357.    * the screen so that if this user does not have a top box then when he
  1358.    * removes all his manual pages we can kill off the xman process.
  1359.    * To make things easier we will consider the top box a shown manual page
  1360. !  * here, but since you cannot remove it, man_page_show only goes to zero when
  1361.    * no top box is present.
  1362.    */
  1363.   
  1364. --- 137,143 ----
  1365.    * the screen so that if this user does not have a top box then when he
  1366.    * removes all his manual pages we can kill off the xman process.
  1367.    * To make things easier we will consider the top box a shown manual page
  1368. !  * here, but since you cannot remove it, man_page_shown only goes to zero when
  1369.    * no top box is present.
  1370.    */
  1371.   
  1372. ***************
  1373. *** 174,180 ****
  1374.   int argc;
  1375.   {
  1376.     int i;
  1377. -   char * prog;
  1378.   
  1379.     static char **syntax, *syntax_def[] = {
  1380.     "-helpfile <filename>",    "Specifies the helpfile to use.",
  1381. --- 173,178 ----
  1382. ***************
  1383. *** 205,217 ****
  1384.     for (i = 1; i < argc ; i++) 
  1385.       (void) printf("This argument is unknown to Xman: %s\n", argv[i]);
  1386.     
  1387. -   if ( (prog = rindex(argv[0], '/')) == NULL)
  1388. -     prog = argv[0];
  1389.     (void) printf("\nKnown arguments are:\n");
  1390.   
  1391.     while ( *syntax != NULL ) {
  1392. !     printf("%-20s - %s\n", syntax[0], syntax[1]);
  1393.       syntax += 2;
  1394.     }
  1395.   }
  1396. --- 203,212 ----
  1397.     for (i = 1; i < argc ; i++) 
  1398.       (void) printf("This argument is unknown to Xman: %s\n", argv[i]);
  1399.     
  1400.     (void) printf("\nKnown arguments are:\n");
  1401.   
  1402.     while ( *syntax != NULL ) {
  1403. !     printf("%-30s - %s\n", syntax[0], syntax[1]);
  1404.       syntax += 2;
  1405.     }
  1406.   }
  1407. *** /tmp/,RCSt1a17248    Fri Jan  6 18:57:03 1989
  1408. --- clients/xman/search.c    Fri Jan  6 18:42:29 1989
  1409. ***************
  1410. *** 1,7 ****
  1411.   /*
  1412.    * xman - X window system manual page display program.
  1413.    *
  1414. !  * $XConsortium: search.c,v 1.2 88/09/04 20:27:33 swick Exp $
  1415.    * $oHeader: search.c,v 4.0 88/08/31 22:13:19 kit Exp $
  1416.    *
  1417.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  1418. --- 1,7 ----
  1419.   /*
  1420.    * xman - X window system manual page display program.
  1421.    *
  1422. !  * $XConsortium: search.c,v 1.3 89/01/06 18:42:28 kit Exp $
  1423.    * $oHeader: search.c,v 4.0 88/08/31 22:13:19 kit Exp $
  1424.    *
  1425.    * Copyright 1987, 1988 Massachusetts Institute of Technology
  1426. ***************
  1427. *** 21,27 ****
  1428.    */
  1429.   
  1430.   #if ( !defined(lint) && !defined(SABER))
  1431. !   static char rcs_version[] = "$Athena: search.c,v 4.0 88/08/31 22:13:19 kit Exp $";
  1432.   #endif
  1433.   
  1434.   #include "globals.h"
  1435. --- 21,27 ----
  1436.    */
  1437.   
  1438.   #if ( !defined(lint) && !defined(SABER))
  1439. !   static char rcs_version[] = "$Athena: search.c,v 4.7 89/01/06 15:59:02 kit Exp $";
  1440.   #endif
  1441.   
  1442.   #include "globals.h"
  1443. ***************
  1444. *** 35,41 ****
  1445.   #define SEARCHARGS 10
  1446.   
  1447.   FILE * DoManualSearch();
  1448. ! struct entry * BEntrySearch();
  1449.   
  1450.   /*    Function Name: MakeSearchWidget
  1451.    *    Description: This Function Creates the Search Widget.
  1452. --- 35,41 ----
  1453.   #define SEARCHARGS 10
  1454.   
  1455.   FILE * DoManualSearch();
  1456. ! static int BEntrySearch();
  1457.   
  1458.   /*    Function Name: MakeSearchWidget
  1459.    *    Description: This Function Creates the Search Widget.
  1460. ***************
  1461. *** 66,72 ****
  1462.     popup_shell = XtCreatePopupShell(SEARCHNAME, transientShellWidgetClass, 
  1463.                      parent, arglist, num_args);
  1464.   
  1465. !   box = XtCreateWidget("box",boxWidgetClass, popup_shell,NULL,0);
  1466.   
  1467.     num_args = 0;
  1468.     XtSetArg(arglist[num_args], XtNborderWidth, 0);
  1469. --- 66,72 ----
  1470.     popup_shell = XtCreatePopupShell(SEARCHNAME, transientShellWidgetClass, 
  1471.                      parent, arglist, num_args);
  1472.   
  1473. !   box = XtCreateWidget("box",boxWidgetClass, popup_shell,NULL, (Cardinal) 0);
  1474.   
  1475.     num_args = 0;
  1476.     XtSetArg(arglist[num_args], XtNborderWidth, 0);
  1477. ***************
  1478. *** 81,87 ****
  1479.     XtSetArg(arglist[num_args], XtNeditType, XttextEdit);
  1480.     num_args++;
  1481.   
  1482. !   man_globals->search_string = INIT_SEARCH_STRING;
  1483.   
  1484.     XtSetArg(arglist[num_args], XtNstring, man_globals->search_string);
  1485.     num_args++;
  1486. --- 81,87 ----
  1487.     XtSetArg(arglist[num_args], XtNeditType, XttextEdit);
  1488.     num_args++;
  1489.   
  1490. !   strcpy(man_globals->search_string, INIT_SEARCH_STRING);
  1491.   
  1492.     XtSetArg(arglist[num_args], XtNstring, man_globals->search_string);
  1493.     num_args++;
  1494. ***************
  1495. *** 90,96 ****
  1496.   
  1497.     XtSetArg(arglist[num_args], XtNlength, SEARCH_STRING_LENGTH);
  1498.     num_args++;
  1499. !   XtSetArg(arglist[num_args], XtNcursor, cursors.search_entry);
  1500.     num_args++;
  1501.   
  1502.     text = XtCreateWidget("textWidgetSearch",asciiStringWidgetClass,
  1503. --- 90,96 ----
  1504.   
  1505.     XtSetArg(arglist[num_args], XtNlength, SEARCH_STRING_LENGTH);
  1506.     num_args++;
  1507. !   XtSetArg(arglist[num_args], XtNcursor, resources.cursors.search_entry);
  1508.     num_args++;
  1509.   
  1510.     text = XtCreateWidget("textWidgetSearch",asciiStringWidgetClass,
  1511. ***************
  1512. *** 156,172 ****
  1513.   
  1514.     answer = XtMakeResizeRequest(text, width, height, &width, &height);
  1515.       
  1516. !     switch(answer) {
  1517. !     case XtGeometryYes:
  1518. !     case XtGeometryNo:
  1519. !       break;
  1520. !     case XtGeometryAlmost:
  1521. !       (void) XtMakeResizeRequest(text, width, height, &width, &height);
  1522. !     }
  1523.   
  1524.     XtManageChild(box);
  1525.     XtRealizeWidget(popup_shell);
  1526. !   AddCursor(popup_shell,cursors.search_entry);
  1527.   }
  1528.   
  1529.   /*    Function Name: DoSearch
  1530. --- 156,172 ----
  1531.   
  1532.     answer = XtMakeResizeRequest(text, width, height, &width, &height);
  1533.       
  1534. !   switch(answer) {
  1535. !   case XtGeometryYes:
  1536. !   case XtGeometryNo:
  1537. !     break;
  1538. !   case XtGeometryAlmost:
  1539. !     (void) XtMakeResizeRequest(text, width, height, &width, &height);
  1540. !   }
  1541.   
  1542.     XtManageChild(box);
  1543.     XtRealizeWidget(popup_shell);
  1544. !   AddCursor(popup_shell,resources.cursors.search_entry);
  1545.   }
  1546.   
  1547.   /*    Function Name: DoSearch
  1548. ***************
  1549. *** 212,218 ****
  1550.   
  1551.     if (!strcmp(man_globals->search_string,"") || 
  1552.         (man_globals->search_string[0] == ' ')) {
  1553. !     PrintWarning("You want me to search for what???");
  1554.       return(NULL);
  1555.     }
  1556.   
  1557. --- 212,218 ----
  1558.   
  1559.     if (!strcmp(man_globals->search_string,"") || 
  1560.         (man_globals->search_string[0] == ' ')) {
  1561. !     PrintWarning(man_globals, "You want me to search for what???");
  1562.       return(NULL);
  1563.     }
  1564.   
  1565. ***************
  1566. *** 228,235 ****
  1567.       strcpy(path,manpath);
  1568.   
  1569.     if (type == APROPOS) {
  1570. !     sprintf(cmdbuf,"%s %s %s | %s > %s",APROPOSCOMMAND,path,
  1571. !         man_globals->search_string,APROPOSFILTER,mantmp);
  1572.       sprintf(label,"Results of apropos search on: %s",
  1573.           man_globals->search_string);
  1574.   
  1575. --- 228,234 ----
  1576.       strcpy(path,manpath);
  1577.   
  1578.     if (type == APROPOS) {
  1579. !     sprintf(cmdbuf, APROPOSFILTER, path, man_globals->search_string, mantmp);
  1580.       sprintf(label,"Results of apropos search on: %s",
  1581.           man_globals->search_string);
  1582.   
  1583. ***************
  1584. *** 272,278 ****
  1585.       if (flag) {
  1586.         fclose(file);
  1587.         file = NULL;
  1588. - /*    PrintWarning(string_buf); */
  1589.         ChangeLabel(man_globals->label,string_buf);
  1590.         return(NULL);
  1591.       }
  1592. --- 271,276 ----
  1593. ***************
  1594. *** 285,291 ****
  1595.       file = DoManualSearch(man_globals);
  1596.       if (file == NULL) {
  1597.         sprintf(string_buf,"No manual entry for %s.",man_globals->search_string);
  1598. -       /*    PrintWarning(string_buf); */
  1599.         ChangeLabel(man_globals->label,string_buf);
  1600.         return(NULL);
  1601.       }
  1602. --- 283,288 ----
  1603. ***************
  1604. *** 299,338 ****
  1605.    *    Returns: the filename of the man page.
  1606.    */
  1607.   
  1608.   FILE * 
  1609.   DoManualSearch(man_globals)
  1610.   ManpageGlobals *man_globals;
  1611.   {
  1612. !   struct entry * entry = NULL;
  1613. !   char *string, *name;
  1614. !   int i;
  1615. !   FILE * file;
  1616.   
  1617.   /* search current section first. */
  1618.     
  1619.     string = man_globals->search_string;
  1620.     i = man_globals->current_directory;
  1621. !   entry = BEntrySearch(string, manual[i].entries, manual[i].nentries);
  1622.   
  1623.   /* search other sections. */
  1624.   
  1625. !   if (entry == NULL) {
  1626.       i = -1;            /* At the exit of the loop i needs to
  1627.                      be the one we used. */
  1628.       do {
  1629.         i++;
  1630.         if (i == man_globals->current_directory) i++;
  1631. !       entry = BEntrySearch(string, manual[i].entries, manual[i].nentries);
  1632. !     } while ( (i < sections) && (entry == NULL) );
  1633.     }
  1634. !     
  1635. !   if (entry == NULL)
  1636. !     return(NULL);
  1637. !   name = CreateManpageName(entry->label);
  1638. !   file = FindFilename(man_globals, name, i, entry);
  1639. !   free(name);
  1640. !   return(file);
  1641.   }
  1642.   
  1643.   /*    Function Name: BEntrySearch
  1644. --- 296,344 ----
  1645.    *    Returns: the filename of the man page.
  1646.    */
  1647.   
  1648. + #define NO_ENTRY -100
  1649.   FILE * 
  1650.   DoManualSearch(man_globals)
  1651.   ManpageGlobals *man_globals;
  1652.   {
  1653. !   char *string;
  1654. !   int e_num = NO_ENTRY;
  1655. !   int i, initial_entry;
  1656.   
  1657.   /* search current section first. */
  1658.     
  1659.     string = man_globals->search_string;
  1660.     i = man_globals->current_directory;
  1661. !   e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);
  1662.   
  1663.   /* search other sections. */
  1664.   
  1665. !   if (e_num == NO_ENTRY) {
  1666.       i = -1;            /* At the exit of the loop i needs to
  1667.                      be the one we used. */
  1668.       do {
  1669.         i++;
  1670.         if (i == man_globals->current_directory) i++;
  1671. !       e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);
  1672. !     } while ( (i < sections) && (e_num == NO_ENTRY) );
  1673. !     if (e_num == NO_ENTRY)
  1674. !       return(NULL);
  1675. ! /*
  1676. !  * Manual page found in some other section, unhighlight the current one.
  1677. !  */
  1678. !     XtListUnhighlight(
  1679. !             man_globals->manpagewidgets.box[man_globals->current_directory]);
  1680.     }
  1681. !   else {
  1682. !     /* 
  1683. !      * Highlight the element we are searching for if it is in the directory
  1684. !      * listing currently being shown.
  1685. !      */
  1686. !    
  1687. !     XtListHighlight(man_globals->manpagewidgets.box[i], e_num);
  1688. !   }
  1689. !   return(FindFilename(man_globals, manual[i].entries[e_num]));
  1690.   }
  1691.   
  1692.   /*    Function Name: BEntrySearch
  1693. ***************
  1694. *** 343,377 ****
  1695.    *    Returns: a pointer to the entry found.
  1696.    */
  1697.   
  1698. ! struct entry *  
  1699.   BEntrySearch(string, first, number)
  1700.   char * string;
  1701. ! struct entry * first;
  1702.   int number;
  1703.   {
  1704. !   int check, cmp;
  1705. !   char * c, label[BUFSIZ];
  1706.     
  1707.     while (TRUE) {
  1708.   
  1709. !     if (number == 0)
  1710. !       return(NULL);        /* didn't find it. */
  1711. !   
  1712.       check = number/2;
  1713.   
  1714. !     strcpy (label, first[check].label);
  1715. !     c = index(label, '.');
  1716. !     if (c != NULL);
  1717. !     *c = '\0';
  1718.   
  1719. !     cmp = strcmp(string, label);
  1720.   
  1721. !     if ( cmp == 0 )
  1722. !       return(&(first[check]));
  1723. !     else if (cmp < 0) 
  1724.         number = check;
  1725. !     else /* cmp > 0 */ {
  1726. !       first = &(first[check + 1]);
  1727.         number -= ( check + 1 );
  1728.       }
  1729.     }
  1730. --- 349,391 ----
  1731.    *    Returns: a pointer to the entry found.
  1732.    */
  1733.   
  1734. ! static int
  1735.   BEntrySearch(string, first, number)
  1736.   char * string;
  1737. ! char ** first;
  1738.   int number;
  1739.   {
  1740. !   int check, cmp, len_cmp, global_number;
  1741. !   char *head, *tail;
  1742.     
  1743. +   global_number = 0;
  1744.     while (TRUE) {
  1745.   
  1746. !     if (number == 0) {
  1747. !       return(NO_ENTRY);        /* didn't find it. */
  1748. !     }
  1749.       check = number/2;
  1750.   
  1751. !     head = rindex(first[ global_number + check ], '/');
  1752. !     if (head == NULL) 
  1753. !       PrintError("index failure in BEntrySearch");
  1754. !     head++;
  1755.   
  1756. !     tail = rindex(head, '.');
  1757. !     if (tail == NULL) 
  1758. !       PrintError("index failure in BEntrySearch");
  1759.   
  1760. !     cmp = strncmp(string, head, (tail - head));
  1761. !     len_cmp = strlen(string) - (int) (tail - head);
  1762. !     if ( cmp == 0 && len_cmp == 0) {
  1763. !       return(global_number + check);
  1764. !     }
  1765. !     else if ( cmp < 0 || ((cmp == 0) && (len_cmp < 0)) ) 
  1766.         number = check;
  1767. !     else /* cmp > 0 || ((cmp == 0) && (len_cmp > 0)) */ {
  1768. !       global_number += (check + 1);
  1769.         number -= ( check + 1 );
  1770.       }
  1771.     }
  1772. -- 
  1773. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1774. Moderator of comp.sources.x
  1775.